export default {
  inject: ['getGraph', 'getNode'],
  data() {
    return {
      graph: this.getGraph(),
      vue: this.getGraph().vue,
      param: this.getNode().getProp().param,
      node: this.getNode(),
      nodes: this.getGraph()
        .toJSON()
        .cells.filter(i => {
          return i.shape !== 'edge'
        }),
      edges: this.getGraph()
        .toJSON()
        .cells.filter(i => {
          return i.shape === 'edge'
        }),
    }
  },
  methods: {
    getGraphParam() {
      this.graph = this.getGraph()
      this.vue = this.getGraph().vue
      this.param = this.getNode().getProp().param
      this.node = this.getNode()
      this.nodes = this.getGraph()
        .toJSON()
        .cells.filter(i => {
          return i.shape !== 'edge'
        })
      this.edges = this.getGraph()
        .toJSON()
        .cells.filter(i => {
          return i.shape === 'edge'
        })
      return {
        graph: this.graph,
        vue: this.vue,
        param: this.param,
        node: this.node,
        nodes: this.nodes,
        edges: this.edges,
      }
    },
  },
}
